package com.szxy;

import com.szxy.service.EchoService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: zwz
 * @Date:2020/7/16 17:01
 * @Description:com.szxy
 * @Version:1.0
 **/
@SpringBootApplication
@EnableDiscoveryClient
@RestController
public class DubboConsumerApplication {

    @Reference
    private EchoService echoService;

    public static void main(String[] args) {
        SpringApplication.run(DubboConsumerApplication.class, args);
    }

    @GetMapping("/rpc/{msg}")
    public ResponseEntity<String> echo(@PathVariable("msg") String msg){
        return ResponseEntity.ok("远程调用成功： "+ echoService.echo(msg));
    }
}
